<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


<html>
<script type="text/javascript" src="jquery-1.7.1.js"></script>
	
	<body>
		<form method="post" action="customers">
			<h1>Customer Login</h1>
			<div id="errordiv">
				<b>Invalid Credentials.</b>
			<br><br>
			</div>
			<table>
	
				<tr><td>Username: </td>
				<td><input type="text" name="username" size="20" maxlength="20" value="${username}"/></td></tr>
				<tr><td>Password: </td>
				<td><input type="password" name="password" size="20" maxlength="20" value="${password}"/></td></tr>
			</table><br><br>

			<input id="login" type="button" value="Login"/>	
			<input id="submit" type="submit" name="submit" value="submit"/>	
		</form>
		
	<script language="JavaScript" type="text/JavaScript">
		
	$(window).load(function(){
		$("#submit").hide();
		if('${error}' != "true")
			$("#errordiv").hide();
		if('${userSession}' !=  "" && '${userSession}' !=  null)
			self.location = "customerHome.jsp";
	});

		
		$("#login").click(function(){
			if(!$("input[name=username]").val())
				alert("Please enter Username.");
			else if(!$("input[name=password]").val())
				alert("Please enter Password.");
			else $("#submit").click();
		});
		
	</script>
		
	</body>
</html>